//
//  RecordCell.m
//  jiyujiaProgram
//
//  Created by Jame on 15/10/26.
//  Copyright © 2015年 中良 赵. All rights reserved.
//

#import "RecordCell.h"
#import "MyOrderModel.h"

@implementation RecordCell

- (void)awakeFromNib {
    // Initialization code
}


- (void)setCellWithModel:(NSArray *)model WithIndexPath:(NSIndexPath *)index
{
    MyOrderData *data = model[index.section];
    
    self.nameLabel.text = data.mName;
    self.titleLabel.text = data.course_name;
    self.placeLabel.hidden = YES;
    self.priceLabel.text = data.total_price;
    
    NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init];
    [timeFormatter setDateFormat:@"HH:mm"];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
    NSString *date = [dateFormatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:[data.class_time integerValue]/1000]];
    NSString *start = [timeFormatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:[data.class_time integerValue]/1000]];
    NSString *end = [timeFormatter stringFromDate:[NSDate dateWithTimeInterval:60*60 sinceDate:[NSDate dateWithTimeIntervalSince1970:[data.class_time integerValue]/1000]]];
    NSString *dateString = [NSString stringWithFormat:@"%@   %@-%@",date,start,end];
    self.timeLabel.text = dateString;
    
    self.starView.starImage = ECIMAGENAME(@"star_gray.png");
    self.starView.starHighlightedImage = ECIMAGENAME(@"star_orange.png");
    self.starView.maxRating = 5.0;
    self.starView.horizontalMargin = 12.0;
    self.starView.editable = NO;
    self.starView.displayMode = EDStarRatingDisplayFull;
    self.starView.rating = 0;
    self.starView.backgroundColor = [UIColor clearColor];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
